package edu.ccit.shudong.dto;

import edu.ccit.shudong.entity.Message;
import edu.ccit.shudong.entity.Post;
import lombok.Data;

import java.util.ArrayList;
import java.util.List;

@Data
public class PostDTO {
    private Long userId;
    private Long fromUser;
    private Long toUser;
    private Post post;
    private List<Message> messages;


    public PostDTO() {
        this.post = new Post();
        this.messages = new ArrayList<Message>();
    }

    public void fromUserId(Message message) {
        this.setUserId(message.getUserId());
        this.setFromUser(message.getFromUser());
        this.setToUser(message.getToUser());
    }

    public void setPost(Post post) {
        this.post = post;
    }

    public void addMessage(Message message) {
        this.messages.add(message);
    }

}
